Northwind Test with Yukon

Product Sales for 1997 View

Owner

dbo

Creation Date

10-07-2003 10:31:36

Remarks


Columns

NameTypeLengthIsNullableCollation
CategoryNamenvarchar30SQL_Latin1_General_CP1_CI_AS 
CategoryNamesysname30SQL_Latin1_General_CP1_CI_AS 
ProductNamenvarchar80SQL_Latin1_General_CP1_CI_AS 
ProductNamesysname80SQL_Latin1_General_CP1_CI_AS 
ProductSalesmoney8 

View Definition

create view "Product Sales for 1997" AS
SELECT Categories.CategoryName, Products.ProductName, 
Sum(CONVERT(money,("Order Details".UnitPrice*Quantity*(1-Discount)/100))*100) AS ProductSales
FROM (Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID) 
	INNER JOIN (Orders 
		INNER JOIN "Order Details" ON Orders.OrderID = "Order Details".OrderID) 
	ON Products.ProductID = "Order Details".ProductID
WHERE (((Orders.ShippedDate) Between '19970101' And '19971231'))
GROUP BY Categories.CategoryName, Products.ProductName